<template>
  <el-dialog title="提现审核" :visible.sync="visible" :close-on-click-modal="false">
    <div>
      <el-row>
        <el-col style="width: 80px">
          <span>审核操作：</span>
        </el-col>
        <el-col :span="20">
          <el-radio-group v-model="isCheck">
            <el-radio label="1">通过</el-radio>
            <el-radio label="2">不通过</el-radio>
          </el-radio-group>
        </el-col>
      </el-row>
<!--      <el-row v-show="isCheck == 1">-->
<!--        <el-col style="width: 80px">-->
<!--          <span>转账方式：</span>-->
<!--        </el-col>-->
<!--        <el-col :span="20">-->
<!--          <el-radio-group v-model="payMethod">-->
<!--            <el-radio label="0">线下转账</el-radio>-->
<!--            <el-radio label="1">乐刷转账</el-radio>-->
<!--          </el-radio-group>-->
<!--        </el-col>-->
<!--      </el-row>-->
      <el-row v-show="isCheck == 1">
        <el-col style="width: 80px">
          <span>备注：</span>
        </el-col>
        <el-col :span="20">
          <el-input type="textarea" v-model="remark" :autosize="{ minRows: 4, maxRows: 6 }" placeholder=""></el-input>
        </el-col>
      </el-row>
      <el-row style="margin-left: 80px" v-show="isCheck != 1">
        <el-col :span="16">
          <el-input type="textarea" v-model="refuseExt" :autosize="{ minRows: 4, maxRows: 6 }"
            placeholder="请输入不通过理由"></el-input>
        </el-col>
      </el-row>
      <el-row class="submitBtn">
        <el-button :loading="loading" size="mini" type="primary" @click="submitClick">提 交</el-button>
      </el-row>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'auditWithdraw',
  data() {
    return {
      visible: false,
      refuseExt: '',
      isCheck: '1',
      loading: false,
      ids: [],
      payMethod: '0',
      remark: '',
    }
  },
  methods: {
    init(ids) {
      this.visible = true
      this.ids = ids
    },
    submitClick() {
      if (this.isCheck == 2) {
        if (!this.refuseExt) {
          this.$message.error('请输入驳回原因')
          return
        }
      }
      this.loading = true
      this.$http({
        url: this.$http.adornUrl('/v1/merchant/partner/batch/cash/out/examine'),
        method: 'POST',
        data: this.$http.adornData({
          ids: this.ids,
          status: this.isCheck == 1 ? 2 : 1,
          remark: this.isCheck == 1 ? this.remark : this.refuseExt,
          payMethod: this.payMethod
        })
      }).then(res => {
        this.loading = false
        if (res.data.code == 0) {
          this.$message({
            message: '操作成功',
            type: 'success',
            duration: 1500,
            onClose: () => {
              this.visible = false
              this.$emit('refreshDataList')
            }
          })
        }
        console.log(res)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.el-row {
  margin-bottom: 15px;
}

.status {
  color: #0a98ff;
}

.submitBtn {
  display: flex;
  justify-content: center;
}
</style>
